var opinionPrice;

/**
 * 设置结果接收对象
 * @param _opinionPrice
 */
function setModel(_opinionPrice) {
    if (_opinionPrice == undefined || !(_opinionPrice instanceof com.jf.crawl.model.OpinionPrice)) {
        throw new java.lang.Exception("opinionPrice 对象为空");
    }
    log.info("opinionPrice {}", _opinionPrice)
    opinionPrice = _opinionPrice;
}

function crawler() {
    //爱钱进
    //1--5.8
    //3--6.35
    //12--9.35
    //6--7.35
    //18--9.8
    var result = Get("http://www.iqianjin.com/criteriaPlanPlus/planData?_=1508145415047");
    var jsonObject = JSON.parseObject(result);
    if (jsonObject.containsKey("bean")) {
        var jsonArray = jsonObject.getJSONArray("bean");
        for (var i = 0; i < jsonArray.size(); i++) {
            jsonObject = jsonArray.getJSONObject(i);
            var period = jsonObject.getString("period");
            var basicProfileRate = jsonObject.getString("basicProfileRate");
            if ("1".equals(period)) {
                opinionPrice.setOneMonth(commonUtil.string2Decimal(basicProfileRate));
            } else if ("3".equals(period)) {
                opinionPrice.setThreeMonth(commonUtil.string2Decimal(basicProfileRate));
            } else if ("6".equals(period)) {
                opinionPrice.setSixMonth(commonUtil.string2Decimal(basicProfileRate));
            } else if ("12".equals(period)) {
                opinionPrice.setOneYear(commonUtil.string2Decimal(basicProfileRate));
            }
        }
    }
    return true;
}